<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>relative</title>
    <style>
        .parent-element {
            width: 400px;
            height: 400px;
            margin-left: 200px;
            background-color: burlywood;
        }

        .main-left {
            background-color: aqua;
            height: 200px;
            width: 200px;
            /* relative定位 */
            position: relative;
            left: 100px;
            top: 100px;
        }

        .main-right {
            background-color: cadetblue;
            height: 200px;
            width: 200px;
            /* relative定位 */
            position: relative;
            right: 100px;
            bottom: 100px;
        }
    </style>
</head>

<body>
    <div class="parent-element">
        <!-- 父容器，为了更好演示相对定位的效果 -->
        <div class="main-left">
            <!-- 相对父元素该元素本应该在的地方，向左偏移了100px，向下偏移了100px -->
        </div>
        <div class="main-right">
            <!-- 相对父元素该元素本应该在的地方，向右偏移了100px，向上偏移了100px -->
        </div>
    </div>

</body>

</html>